<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>iOS基础教程-文件操作_技术学习教程_慕课网</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">

    <meta http-equiv="Access-Control-Allow-Origin" content="*" />
    <meta http-equiv="Cache-Control" content="no-transform " />

    <meta name="Keywords" content="" />

    <meta name="Description" content="从沙盒机制为切入点,通过对常见需求的分析,详细讲解iOS自有的文件处理类和SQLite的基本知识以及在项目开发中的简单使用.内容涉及文件夹和文件的创建和删除,SQLite的增删改查.
"/>

    <link rel="stylesheet" href="__PUBLIC__/css/base.css?v=1461734761" type="text/css"/>
    <link rel="stylesheet" href="__PUBLIC__/css/common-less.css?v=1461734761" type="text/css"/>
    <link rel="stylesheet" href="__PUBLIC__/css/course/common-lessc.css.css?v=1461734761" type="text/css"/>
    <link rel="stylesheet" href="__PUBLIC__/css/course/course-learn-less.css.css?v=1461734761" type="text/css"/>
    <link rel="stylesheet" href="__PUBLIC__/css/font-awesome.min.css" type="text/css" />
    <!-- <link rel="stylesheet" href="http://static.mukewang.com/static/css/??base.css,common/common-less.css,course/common-less.css,course/learn-less.css?v=1462329760" type="text/css" /> -->
</head>
<body >

<div id="header">
    <div class="page-container" id="nav">
        <div id="logo" class="logo">
            <a href="/" target="_self" class="hide-text">慕课网</a>
        </div>

        <button type="button" class="navbar-toggle visible-xs-block js-show-menu" > <i class="icon-menu"></i>
        </button>
        <ul class="nav-item">
            <li class="set-btn visible-xs-block">
                <a href="/u/3224635/courses" target="_self">
                    <img src='http://img.mukewang.com/user/545862aa0001f8da02200220-40-40.jpg' width='40' height='40' />
                </a>
            <li>
                <a href="/course/list" class="active" target="_self">课程</a>
            </li>
            <li>
                <a href="http://coding.imooc.com" target="_self">
                    实战 <i class="icn-new"></i>
                </a>
            </li>
            <li>
                <a href="/course/program"  target="_self">计划</a>
            </li>
            <li>
                <a href="/wenda"  target="_self">猿问</a>
            </li>
            <li>
                <a href="/article"  target="_self">手记</a>
            </li>
            <li class="visible-xs-block">
                <a href="/user/setprofile" target="_self">我的设置</a>
            </li>
            <li class="visible-xs-block">
                <a href="/passport/user/logout?referer=http://www.imooc.com" target="_self">退出</a>
            </li>

        </ul>

        <div id="login-area">
            <ul class="clearfix logined">
                <li class="header-app">
                    <a href="/mobile/app" >
                        <span class="icon-appdownload"></span>
                    </a>
                    <div class="QR-download">
                        <p id="app-text">慕课网APP下载</p>
                        <p id="app-type">iPhone / Android / iPad</p>
                        <img src="/static/img/index/QR-code.jpg"></div>
                </li>
                <li class='remind_warp'>
                    <i class="msg_remind"></i>
                    <a target="_blank" href='/u/3224635/notices'>
                        <i class='icon-notifi'></i>
                    </a>
                </li>
                <li class="my_message">
                    <a href="/u/3224635/messages" title="我的消息" target="_blank">
                        <span class="msg_icon" style="display: none;"></span>
                        <i class="icon-mail"></i>
                        <span style="display: none;">我的消息</span>
                    </a>
                </li>
                <li class="set_btn user-card-box">
                    <a id="header-avator" class="user-card-item" action-type="my_menu"  href="/u/3224635/courses" target="_self">
                        <img src='http://img.mukewang.com/user/545862aa0001f8da02200220-40-40.jpg' width='40' height='40' />
                        <i class="myspace_remind" style="display: none;"></i>
                        <span style="display: none;">动态提醒</span>
                    </a>
                    <div class="g-user-card">
                        <div class="card-inner">
                            <div class="card-top">
                                <a href='/u/3224635/courses'>
                                    <img src="http://img.mukewang.com/545862aa0001f8da02200220-100-100.jpg" alt="慕粉3224635" class="l"></a>
                                <a href='/u/3224635/courses'>
                                    <span class="name text-ellipsis">慕粉3224635</span>
                                </a>
                                <p class="meta">
                                    <a href="/u/3224635/experience">
                                        经验 <b id="js-user-mp">40</b>
                                    </a>
                                    <a href="/u/3224635/credit">
                                        积分 <b id="js-user-credit">0</b>
                                    </a>
                                </p>

                                <a href='/user/setprofile' class='icon-set setup'></a>
                            </div>
                            <!--
                    <div class="card-links">
                            <a href="/space/index" class="my-mooc l">
                                我的慕课
                                <i class="dot-update"></i>
                            </a>
                            <span class="split l"></span>
                            <a href="/myclub/myquestion/t/ques" class="my-sns l">我的社区</a>
                        </div>
                        -->
                            <div class="card-history">
                                    <span class="history-item">
                                        <span class="tit text-ellipsis">iOS基础教程-文件操作</span>
                                        <span class="media-name text-ellipsis">1-1 学习指南</span>
                                        <i class="icon-clock"></i>
                                        <a href="/video/11766" class="continue">继续</a>
                                    </span>
                            </div>
                            <div class="card-sets clearfix">
                                <a href="/wenda/save" target="_blank" class="l mr30">发问题</a>
                                <a href="/article/publish" target="_blank" class="l">写文章</a>
                                <a href="/passport/user/logout?referer=http://www.imooc.com" class="r">退出</a>
                            </div>
                        </div>
                        <i class="card-arr"></i>
                    </div>
                </li>
            </ul>
        </div>
        <!--
    <div class="app-down-area r">
        <a href="/mobile/app">
            <i class="header-app-icon"></i>
            慕课APP
        </a>
    </div>
    -->
        <div class='search-warp clearfix' style='min-width: 32px; height: 60px;'>
            <div class="search-area min" data-search="top-banner">
                <input class="search-input" data-suggest-trigger="suggest-trigger" placeholder="请输入想搜索的内容..." type="text" autocomplete="off">
                <input type='hidden' class='btn_search' data-search-btn="search-btn" />
                <ul class="search-area-result" data-suggest-result="suggest-result"></ul>
            </div>
            <div class='showhide-search' data-show='no'>
                <i class='icon-search'></i>
            </div>
        </div>
    </div>
</div>

<div id="main">

    <div class="course-infos">
        <div class="w pr">
            <div class="path">
                <a href="/course/list">课程</a>
                <i class="path-split">\</i>
                <a href="/course/list?c=mobile">移动开发</a>
                <i class="path-split">\</i>
                <a href="/course/list?c=ios">iOS</a>
                <i class="path-split">\</i>
                <a href="/view/655">
                    <span>iOS基础教程-文件操作</a>
                </span>
            </div>
            <div class="hd">
                <h2 class="l">iOS基础教程-文件操作</h2>
            </div>
            <div class="statics clearfix">
                <div class="static-item ">
                    <span class="meta-value"> <strong>初级</strong>
                    </span>
                    <span class="meta">难度</span> <em></em>
                </div>
                <div class="static-item static-time">
                    <span class="meta-value"> <strong>1</strong>
                        小时
                        <strong>8</strong>
                        分
                    </span>
                    <span class="meta">时长</span> <em></em>
                </div>
                <div class="static-item">
                    <span class="meta-value">
                        <strong>69</strong>
                    </span>
                    <span class="meta">学习人数</span>
                    <em></em>
                </div>
                <!-- <div class="static-item">
                <span class="meta-value">
                    <strong>4.8分</strong>
                </span>
                <span class="meta">
                    <i class="meta-star"></i>
                    <i class="meta-star"></i>
                    <i class="meta-star"></i>
                </span>
                <em></em>
            </div>
            -->
            </div>
            <div class="extra">
                <!-- credit -->
                <div class="share-rl-tips share-posi js-share-statue">
                    <span>分享即可 +</span>
                    <strong>1积分</strong>
                    <span class="rule-arrow"></span>
                </div>
                <!-- share -->
                <div class="share-action r bdsharebuttonbox">
                    分享
                    <a href="javascript:;" class="share wx js-share" data-cmd="weixin"></a>
                    <a href="javascript:;" class="share qq js-share" data-cmd="qzone"></a>
                    <a href="javascript:;" class="share sina js-share" data-cmd="tsina"></a>
                </div>
                <i class="split-line r"></i>
                <a href="javascript:;" data-cmd="follow" class="follow-action r js-follow-action" data-cid="655">关注</a>
            </div>
        </div>
        <div class="info-bg" id="js-info-bg">
            <div class="cover-img-wrap">
                <img data-src="http://img.mukewang.com/57281f560001688206000338.jpg" alt="" style="display: none" id="js-cover-img"></div>
            <div class="cover-mask"></div>
        </div>
    </div>
    <div class="course-info-main clearfix w has-progress">

        <div class="info-bar clearfix">
            <a href="/video/11766" target="_blank" class="btn-red start-study-btn r J-learn-course">继续学习</a>
            <span class="start-study-title">1-1 学习指南</span>
            <div class="exp-progress">
            <span class="exp-txt">
                <span class="exp-per">
                    <strong>0</strong>
                    %
                </span>
                用时
                <span class="exp-time">
                    <i>0</i>
                    分
                </span>
            </span>
                <div class="exp-bar"> <ins style="width: 0%"></ins>
                </div>
            </div>
            <div class="score-info">
                <div class="satisfaction-degree-info">
                    <h3>综合评分</h3>
                    <h4>10.0</h4>
                    <div class="star-box">
                        <i class="icon-star2 active"></i>
                        <i class="icon-star2 active"></i>
                        <i class="icon-star2 active"></i>
                        <i class="icon-star2 active"></i>
                        <i class="icon-star2 active"></i>
                    </div>
                </div>
                <!--satisfaction-degree-info end-->
                <div class="info-box clearfix">
                <span>
                    发表评价即可
                    <em>+1积分</em>
                </span>
                    <a href="/course/coursescore?id=655" target="_blank">立即去评价</a>
                </div>
                <p class="person-num noLogin">
                    <a href="/course/coursescore?id=655" target="_blank">0人评价</a>
                </p>
            </div>
            <!--score-info end--> </div>
        <div class="content-wrap clearfix">
            <div class="content">
                <div class="mod-tab-menu">
                    <ul class="course-menu clearfix">
                        <li>
                            <a class="ui-tabs-active active" id="learnOn"  href="/learn/655">
                                <span>章节</span>
                            </a>
                        </li>
                        <li>
                            <a id="commentOn" class="" href="/comment/655">
                                <span>评论</span>
                            </a>
                        </li>
                        <li>
                            <a id="qaOn" class="" href="/qa/655">
                                <span>问答</span>
                            </a>
                        </li>
                        <li>
                            <a id="noteOn" class="" href="/note/655?sort=last">
                                <span>笔记</span>
                            </a>
                        </li>
                        <!--
            <li>
                        <a id="wikiOn" class="" href="/wiki/655">WIKI</a>
                    </li>
                    -->
                    </ul>
                </div>

                <div class="mod-chapters">
                    <div class="chapter chapter-active" >
                        <h3>
                            <span class="icon-sub"></span>
                            <strong><i class="state-expand"></i>
                                第1章 学习指南</strong>
                        </h3>
                        <ul class="video">
                            <li>
                                <em class="laststudy">最近学习</em>
                                <a target="_blank" href='/video/11766' class="J-media-item studyvideo">
                                    1-1 学习指南 (00:51)
                                    <i class="study-state ing"></i>
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="chapter" >
                        <h3>
                            <span class="icon-plus"></span>
                            <strong><i class="state-expand"></i>
                                第2章 沙盒介绍</strong>
                        </h3>
                        <ul class="video">
                            <li>
                                <a target="_blank" href='/video/11767' class="J-media-item studyvideo">
                                    2-1 沙盒介绍 (03:34)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                            <li>
                                <a target="_blank" href='/video/11768' class="J-media-item studyvideo">
                                    2-2 获取Document路径 (08:10)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                            <li>
                                <a target="_blank" href='/video/11769' class="J-media-item studyvideo">
                                    2-3 获取Library和Temp路径 (04:52)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="chapter" >
                        <h3>
                            <span class="icon-plus"></span>
                            <strong>
                                <i class="state-expand"></i>
                                第3章 数据的转换
                            </strong>
                        </h3>
                        <ul class="video">
                            <li>
                                <a target="_blank" href='/video/11770' class="J-media-item studyvideo">
                                    3-1 NSString类的路径函数的处理 (08:20)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                            <li>
                                <a target="_blank" href='/video/11771' class="J-media-item studyvideo">
                                    3-2 NSData数据转换 (06:17)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="chapter" >
                        <h3>
                            <span class="icon-plus"></span>
                            <strong>
                                <i class="state-expand"></i>
                                第4章 文件操作详解
                            </strong>
                        </h3>
                        <ul class="video">
                            <li>
                                <a target="_blank" href='/video/11772' class="J-media-item studyvideo">
                                    4-1 使用NSFileManager创建文件夹 (05:59)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                            <li>
                                <a target="_blank" href='/video/11773' class="J-media-item studyvideo">
                                    4-2 写入文件 (09:27)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                            <li>
                                <a target="_blank" href='/video/11774' class="J-media-item studyvideo">
                                    4-3 追加文件内容 (07:35)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                            <li>
                                <a target="_blank" href='/video/11775' class="J-media-item studyvideo">
                                    4-4 删除文件 (04:51)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="chapter" >
                        <h3>
                            <span class="icon-plus"></span>
                            <strong>
                                <i class="state-expand"></i>
                                第5章 实例讲解
                            </strong>
                        </h3>
                        <ul class="video">
                            <li>
                                <a target="_blank" href='/video/11776' class="J-media-item studyvideo">
                                    5-1 实例操作 (07:08)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="chapter" >
                        <h3>
                            <span class="icon-plus"></span>
                            <strong>
                                <i class="state-expand"></i>
                                第6章 课程总结
                            </strong>
                        </h3>
                        <ul class="video">
                            <li>
                                <a target="_blank" href='/video/11777' class="J-media-item studyvideo">
                                    6-1 课程总结 (01:04)
                                    <i class="study-state"></i>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>

            </div>
            <div class="aside r">
                <div class="bd">

                    <div class="box mb40">
                        <h4>讲师提示</h4>
                        <div class="teacher-info">
                            <a href="/u/2642250/courses?sort=publish" target="_blank">
                                <img src='http://img.mukewang.com/user/565e844f0001ff0a04100410-80-80.jpg' width='80' height='80' />
                            </a>
                    <span class="tit">
                        <a href="/u/2642250/courses?sort=publish" target="_blank">Keegan</a>
                        <i class="icon-imooc"></i>
                    </span>
                            <span class="job">移动开发工程师</span>
                        </div>
                        <div class="course-info-tip">
                            <dl class="first">
                                <dt>课程须知</dt>
                                <dd class="autowrap">掌握iOS的函数、字符处理等基本的语法.</dd>
                            </dl>
                            <dl>
                                <dt>老师告诉你能学到什么？</dt>
                                <dd class="autowrap">
                                    1. 掌握iOS文件处理类的基本语法和使用场景.
                                    2. 掌握SQLite的基本语法和使用场景.
                                    3. 项目应用,制作简单交互式页面.
                                </dd>
                            </dl>
                        </div>
                    </div>

                    <div class="cp-other-learned  js-comp-tabs">
                        <div class="cp-header clearfix">
                            <h2 class="cp-tit l">该课的同学还学过</h2>
                            <ul class="cp-tabs r"></ul>
                        </div>
                        <div class="cp-body">
                            <div class="cp-tab-pannel js-comp-tab-pannel" data-pannel="course" style="display: block">
                                <!-- img 200 x 112 -->
                                <ul class="other-list">
                                    <li class="curr">
                                        <a href="/view/85?src=sug" target="_blank">
                                            <img src="http://img.mukewang.com/57035ff200014b8a06000338-240-135.jpg" alt="Java入门第一季">
                                            <span class="name autowrap">Java入门第一季</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/view/124?src=sug" target="_blank">
                                            <img src="http://img.mukewang.com/570360620001390f06000338-240-135.jpg" alt="Java入门第二季">
                                            <span class="name autowrap">Java入门第二季</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/view/36?src=sug" target="_blank">
                                            <img src="http://img.mukewang.com/53e1d0470001ad1e06000338-240-135.jpg" alt="JavaScript入门篇">
                                            <span class="name autowrap">JavaScript入门篇</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/view/10?src=sug" target="_blank">
                                            <img src="http://img.mukewang.com/529dc3450001eb3606000338-240-135.jpg" alt="JavaScript进阶篇">
                                            <span class="name autowrap">JavaScript进阶篇</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/view/110?src=sug" target="_blank">
                                            <img src="http://img.mukewang.com/5703604a0001694406000338-240-135.jpg" alt="Java入门第三季">
                                            <span class="name autowrap">Java入门第三季</span>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <div class="clear"></div>

    </div>

</div>

<div id="footer" >
    <div class="waper">
        <div class="footerwaper clearfix">
            <div class="followus r">
                <a class="followus-weixin" href="javascript:;"  target="_blank" title="微信">
                    <div class="flw-weixin-box"></div>
                </a>
                <a class="followus-weibo" href="http://weibo.com/u/3306361973"  target="_blank" title="新浪微博"></a>
                <a class="followus-qzone" href="http://user.qzone.qq.com/1059809142/" target="_blank" title="QQ空间"></a>
            </div>
            <div class="footer_intro l">
                <div class="footer_link">
                    <ul>
                        <li>
                            <a href="http://www.imooc.com/" target="_blank">网站首页</a>
                        </li>
                        <li>
                            <a href="/about/job" target="_blank">人才招聘</a>
                        </li>
                        <li>
                            <a href="/about/contact" target="_blank">联系我们</a>
                        </li>
                        <li>
                            <a href="http://yun.imooc.com/" target="_blank">慕课云</a>
                        </li>
                        <li>
                            <a href="/corp/index" target="_blank">合作专区</a>
                        </li>
                        <li>
                            <a href="/about/us" target="_blank">关于我们</a>
                        </li>
                        <li>
                            <a href="/about/recruit" target="_blank">讲师招募</a>
                        </li>
                        <li>
                            <a href="/user/feedback" target="_blank">意见反馈</a>
                        </li>
                        <li>
                            <a href="/about/friendly" target="_blank">友情链接</a>
                        </li>
                    </ul>
                </div>
                <p>
                    Copyright © 2016 imooc.com All Rights Reserved | 京ICP备 13046642号-2
                </p>
            </div>
        </div>
    </div>
</div>
<div id="J_GotoTop" class="elevator">
    <a class="elevator-weixin" href="javascript:;">
        <div class="elevator-weixin-box"></div>
    </a>
    <a class="elevator-msg" href="/user/feedback" target="_blank" id="feedBack"></a>
    <a class="elevator-app" href="http://www.imooc.com/mobile/app" >
        <div class="elevator-app-box"></div>
    </a>
    <a class="elevator-top" href="javascript:;" style="display:none" id="backTop"></a>
</div>

<!--script-->
<script src="/passport/static/scripts/ssologin.js"></script>
<script type="text/javascript" src="/static/sea-modules/seajs/seajs/2.1.1/sea.js"></script>
<script type="text/javascript" src="/static/sea_config.js?v=201604211612"></script>
<script type="text/javascript">seajs.use("/static/page/"+OP_CONFIG.module+"/"+OP_CONFIG.page);</script>

<script type="text/javascript">
    (function(){
        var imgPic = GC.course.pic || 'http://img.mukewang.com/static/img/common/logo.png',
                text = '我正在参加@慕课网  的一门课程【' + GC.course.name + '】，很不错哦！快来一起学习吧！', //节名称
                url = 'http://www.mukewang.com' + window.location.pathname;

        window._bd_share_config = {
            "common": {
                "bdUrl": url,
                "bdSnsKey": {
                    'tsina':'2788596354'
                },
                "bdText": text,
                "bdMini": "2",
                "bdMiniList": false,
                "bdPic": imgPic,
                "bdStyle": "0",
                "bdSize": "16"
            },
            "share": {}
        };
        with(document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];
    })();
</script>
<div class="mask"></div>

<div style="display: none">
    <script type="text/javascript">
        var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
        document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Ff0cfcccd7b1393990c78efdeebff3968' type='text/javascript'%3E%3C/script%3E"));
        (function (d) {
            window.bd_cpro_rtid="rHT4P1c";
            var s = d.createElement("script");s.type = "text/javascript";s.async = true;s.src = location.protocol + "//cpro.baidu.com/cpro/ui/rt.js";
            var s0 = d.getElementsByTagName("script")[0];s0.parentNode.insertBefore(s, s0);
        })(document);
    </script>
    <script>
        (function(){
            var bp = document.createElement('script');
            bp.src = '//push.zhanzhang.baidu.com/push.js';
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(bp, s);
        })();
    </script>
</div>
</body>
</html>